<div id="performancesPage">
    <div class="post">
        <h2 class="title">Performances</h2>
        <div class="entry">
            <input type="button" value="Add new" onclick="show('#new_performance')"/>
            <?php
            if ($this->session->userdata("admin")) {
            ?>
                <input type="button" value="Search" onclick="show('#searchPerformances')"/>
                <input type="button" value="Clear Search" onclick="clearSearch()"/>
            <?php
            }
            ?>
            <script type="text/javascript">
                function searchPerformances(num){
                    field=document.getElementById("searchPerformancesForm"+num).field.value;
                    search=document.getElementById("searchPerformancesForm"+num).search.value;
                    $("#performancesPage").load("<?= base_url(); ?>index.php?/admin_mis/performances/"+field+"/"+search);
                }
                function clearSearch(){
                    $("#performancesPage").load("<?= base_url(); ?>index.php?/admin_mis/performances/");
                }
            </script>
            <div id="performances_result" class="info">
                <?= $message; ?>
            </div>
            <!--a href="" id="hide3" >Hide</a> <a href="" id="show3" >Show</a-->
            <div id="new_performance" style="display: none;margin-bottom: 10px;">
                <?php $data['id'] = "performance_form" ?>
                <?= form_open_multipart('mis/savePerformance', $data); ?>
                <table>
                    <tr class="lighter"><td class="half">Department</td><td>
                            <select name="department">
                                <?php foreach ($department as $type): ?>
                                    <option value="<?= $type->tid; ?>"><?= $type->name; ?></option>
                                <?php endforeach; ?>
                                </select>
                            </td> </tr>
                        <tr  class="darker"><td>Annual budget amount</td><td><input type="text"  class="wide" name="budget" value="<?php echo set_value('budget'); ?>" /></td> </tr>
                        <tr class="lighter"><td class="half">Amount spent in Quarter 1</td><td><input type="text" class="wide" name="quarter1" value="<?php echo set_value('quarter1'); ?>" /></td> </tr>
                        <tr class="darker"><td>Amount spent in Quarter 2</td><td><input type="text" class="wide"  name="quarter2" value="<?php echo set_value('quarter2'); ?>"/></td> </tr>
                        <tr  class="lighter"><td>Amount spent in Quarter 3</td><td><input type="text"  class="wide" name="quarter3" value="<?php echo set_value('quarter3'); ?>" /></td> </tr>
                        <tr  class="darker"><td>Amount spent in Quarter 4</td><td><input type="text"  class="wide" name="quarter4" value="<?php echo set_value('quarter4'); ?>" /></td> </tr>

                        <tr><td colspan="2" style="text-align: right">
                                <input type="submit" value="Submit" />
                                <input type="button" value="Cancel" onclick="hide('#new_performance')"/>
                            </td></tr>
                    </table>
                    </form>
                </div>



                <div id="searchPerformances" style="display: none;margin-bottom: 10px;">
                    <form id="searchPerformancesForm1">
                        <input type="hidden" name="field" value="department"/>
                        <table>
                            <tr class="darker"><td class="half">Search by department</td>
                                <td><select name="search">
                                    <?php foreach ($department as $type): ?>
                                        <option value="<?= $type->tid; ?>"><?= $type->name; ?></option>
                                    <?php endforeach; ?>
                                    </select></td>
                            </tr>

                            <tr><td colspan="2" style="text-align: right">
                                    <input type="button" value="Submit" onclick="searchPerformances(1)" />
                                    <input type="button" value="Cancel" onclick="hide('#searchPerformances')"/>
                                </td></tr>

                        </table>
                    </form>
                    <form id="searchPerformancesForm2">
                        <table>
                            <tr class="darker"><td class="half">Select search criteria</td>
                                <td><select name="field">
                                        <option value='added_by'> Added by</option>
                                    </select></td>
                                <td><input type="text" name="search" class="wide"  value="<?php echo set_value('added_by'); ?>" /></td>
                            </tr>

                            <tr><td colspan="3" style="text-align: right">
                                    <input type="button" value="Submit" onclick="searchPerformances(2)" />
                                    <input type="button" value="Cancel" onclick="hide('#searchPerformances')"/>
                                </td></tr>

                        </table>
                    </form>
                </div>




                <div id="all_performance">
                <?= $tablet ?>
                <?= $pagina ?>
            </div>

        </div>
    </div>
</div>